Ibevent:Reactor Reactor Model:Key parts:1) Event SourceLinux is a file descriptor, Windows is a socket or handle, here is known as a "handle set", the program on the specified handle register the event of interest, such as I/O events.2) Event demultiplexer--events Multi-channel collection and distribution mechanism (in fact, epoll, etc., directly used in reactor)The I/O multiplexing mechanisms provided by the operating system, such as SELECT and Epoll
management of the operating system resources, including: network links, open files, timers, synchronization objects and so on. Linux is a file descriptor, on Windows is the Socket or Handle , where unification is called a "handle set", and the program registers the event of interest, such as an I/O event, on the specified handle .
Event demultiplexer--Events Multi-channel distribution mechanism
The I/O multiplexing mechanisms provided
associated with multiple event sources.Advantages of Reactor Mode
The Reactor mode isOne of the essential technologies for writing High-Performance Network ServersIt has the following advantages:
Reactor mode framework
The following components are required to use the Reactor model:Event source, Reactor framework, multiplexing mechanism, and event processing program.
Overall Reactor model framework
Reactor Model UML
Handle event Source
Handle represents the resources managed by the operati
one.
1. source of the event
Linux is a file descriptor, Windows is a socket or handle, here is known as a "handle set", the program on the specified handle register the event of interest, such as I/O events.
2. vent demultiplexer--Event Multi-channel distribution mechanism
The I/O multiplexing mechanisms provided by the operating system, such as SELECT and Epo
use of CPU resources;4) reusability, the reactor framework itself is independent of the specific event handling logic and has high reusability;3.reactor FrameUsing the Reactor model, several components are required: Event source, Reactor framework, multiplexing mechanism, and event handlers1) Event SourceLinux is a file descriptor, Windows is a Socket or Handle, here is known as a "handle set", the program on the specified handle register the event of interest, such as I/O events.2) event
look at the overall framework of the reactor model, and then describe each component one by one.1) Event SourceLinux is a file descriptor, Windows is a socket or handle, here is known as a "handle set", the program on the specified handle register the event of interest, such as I/O events. 2) Event demultiplexer--multi-channel distribution mechanismthe I/O multiplexing mechanisms provided by the operating system, such as SELECT and Epoll. The program
component one by one.
1) event SourceLinux is a file descriptor, while Windows is a socket or handle, which is called a "handle set". A program registers events of interest on the specified handle, such as I/O events.
2) event demultiplexer-multi-channel event distribution mechanismI/O multiplexing mechanisms provided by the operating system, such as select and epoll.The program first registers the handle (event source) and its event to event
tunerequest object and set its LocatorCcomptr pitunerequest = NULL;Pidvbstuningspace-> createtunerequest ( pitunerequest );Ccomqiptr pidvbtunerequest (pitunerequest );Pidvbtunerequest-> put_locator (plocatorval );
The above Code creates a tuning request object (pointer: pidvbtunerequest) to provide it to the network provider filter. The Code does not set the priority Selection Component list, so each output pin of the MPEG-2 demultiplexer filter will
third: Selector.select () Checks whether there is a ready event, and if not, it blocks until the Ready event function returns. reactor
There is an article very well written: http://www.blogjava.net/DLevin/archive/2015/09/02/427045.htmlYou can have a look, I'll emphasize the point here.
Graphic:1. Handle: In network programming, this is generally referred to as a socket Handle, a network connection (Connection, channel in Java NIO). This channel is registered in synchronous event
?? Reactor is a pattern proposed by Schmidt, Douglas C, which is widely used in high concurrency server implementations.The change mode uses event-driven mode, and when the event occurs, the corresponding event-handling code (Handler) is called.This pattern is the basis for high concurrency server. such as Nginx and LIGHTTPD.These two scenarios are ideal for large concurrency, but each with a very fast handling of requests.The usual web interview is this feature.structureContains 5 parts, handle
contains two nodes , you can also split it into two filter , each filter contains a node .
common node Yes network provider , tuner , demodulator and capture , network provider currently, many filters are available, you may need to modify DMB . You can use it most of the time; Tunner and demodulator it is now placed in the same filter , Tunner filter ; capture filter is the core part, reads data from hardware and transmits data back
filter. For example, in the figure above, a filter can contain two nodes or be split into two filters. Each filter contains one node, see what you like.
Common nodes include network provider, tuner, demodulator, capture, and network.The provider currently has many ready-made filters available, which may need to be modified when DMB is used. Most of the time they can be used directly. Tunner and demodulator are now placed in the same filter, called Tunner.Filter; capture filter is the core part.
processing.ContrastSimply record this "pure version" video decoder using only Libavcodec and the different video decoders that use Libavcodec+libavformat.PS: Using the Libavcodec+libavformat decoder reference article "(1) The following functions related to Libavformat do not exist in the "pure version" video decoder.
Av_register_all (): Register all codecs, multiplexing/demultiplexer components, etc. where Avcodec_register_all () is called
associated with it. If not, Tif will create a default locator for it.The network provider filter then requires the tuning tuner to tune to the correct frequency and set the parameter information required by the tuner, such as the forward correction (FEC) rate. After the tuner receives the signal, it forwards it to the capture filter of the receiver ), the capture filter digitizes the signal and sends the digital MPEG-2 transmission stream to the MPEG-2 demu
Dekoda)
7 [Parameter Options]→[filter settings]→[Filter Manager]→[add registered filters], select the "Moonlight Three Kit" separator (Moonlight-elecard MPEG2 demultiplexer) in the list of filters and click OK.
8 When you return to the Filter Manager window, set the priority of this filter to mandatory, and the "Moonlight Three Suite" setting succeeds.
9) Press Alt+f to switch to haste mode, so that you can use the encoder just defined.
18. How t
multiplexing technology. This is in the light wave frequency range, the different wavelength of light waves, at a certain interval arranged in a fiber transmission. The "Wavelength division multiplexing" technology used in optical fiber communication is now developing rapidly. Wavelength Division Multiplexing (WND) is the use of two or more different wavelengths of optical carrier signals (carrying various information) at the transmitter through the multiplexer (also known as the Wave-filter, m
thread in the selector polling, found that channel have read and write events, can be assigned to other threads to handle (usually using the thread pool). AIO
The AIO mode is supported from JDK7. The business logic is handled by registering the event callback function in Asynchronousserversocketchannel. When the IO operation is complete, the callback function is invoked. If you pass in Asynchronouschannelgroup, you can bind the thread pool to handle the event.
On the implementation of JDK, Wind
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.